
#Frame pointer can't be used; calling convention assumes it's not saved.
options = -fomit-frame-pointer -Wall -g 
headers = task.h garnet.h bytecodes.h loader.h memspace.h
objects = main.o task.o garnet.o i386.o program.o loader.o memspace.o heap.o serialize.o

garnet:	$(objects) $(headers) program.gsmbc
	gcc $(options) -o garnet $(objects)

main.o: main.c task.h garnet.h 
	gcc $(options) -c main.c

task.o: task.h task.c
	gcc $(options) -c task.c

garnet.o: garnet.h garnet.c bytecodes.h
	gcc $(options) -c garnet.c

i386.o:	i386.S bytecodes.h
	gcc $(options) -c i386.S 

loader.o: loader.h loader.c bytecodes.h
	gcc $(options) -c loader.c

memspace.o: memspace.h memspace.c
	gcc $(options) -c memspace.c

heap.o:	heap.h heap.c 
	gcc $(options) -c heap.c

serialize.o: serialize.h serialize.c
	gcc $(options) -c heap.c

program.gsmbc: program.gsm bytecodes.h
	./asm.pl program.gsm

clean:
	rm -f *.o *~ garnet *.core program.bin
